<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
<script type="text/javascript" language="javascript">
window.onload=function(){
	document.getElementById("form").onsubmit=function(){
		return checkForm();
	};
};
function checkForm(){
	var form = document.getElementById("form");
	var iderrormsg = document.getElementById("iderrormsg");
	var regex = /^\S+$/;
	var name = form.username.value;
	var psdw = form.password.value;
	if(!regex.test(name)){
		iderrormsg.textContent="name?";
		return false;
	}
	if(!regex.test(psdw)){
		iderrormsg.textContent="password?";
		return false;
	}
	return true;
};
</script>
</head>
<body>
<jsp:include page="header.jsp"></jsp:include>

<s:form id="form" action="loginAction" method="post" >
<table>
<tr><td colspan="2">用户登录</td></tr>
<tr><td>用户名：</td><td><input type="text" name="username" /></td></tr>
<tr><td>密码：</td><td><input type="password" name="password" /></td></tr>
<tr><td><input type="submit" value="登录" /></td></tr>
</table>
</s:form>
<label id="iderrormsg" style="color: red"></label>




</body>
</html>